import { IFormConfig, IFormData, IFormItemConfig, IJlFormInstance } from '@jl/element-plus';
import { ref } from 'vue';

export function create() {
  const formRef = ref<IJlFormInstance>();
  const formConfig: IFormConfig = { gutter: 24, labelWidth: 90 };
  const formData = ref<IFormData>({
    token: '',
  });
  const formItemConfig = ref<IFormItemConfig>([
    {
      type: 'slot',
      slotName: 'slotToken',
      key: 'token',
      label: 'Token',
      span: 24,
      rules: [
        {
          required: true,
          trigger: ['change', 'blur'],
          message: '请输入token',
        },
      ],
    },
    {
      type: 'slot',
      slotName: 'slotLink',
      key: 'link',
      label: '',
      span: 24,
    },
  ]);
  return {
    formRef,
    formConfig,
    formData,
    formItemConfig,
  };
}
